#include "Cpu.h"
#include "user_define.h"
#include "timers.h"
#include <string.h>

#define ADC_INSTANCE    0UL



void ADC_Init(void)
{
    ADC_DRV_ConfigConverter(ADC_INSTANCE, &adConv1_ConvConfig0);
    ADC_DRV_AutoCalibration(ADC_INSTANCE);
}
 
uint16_t ADC_GET_EXT0(void)
{
	uint16_t ADC_result = 0;

	ADC_DRV_ConfigChan(INST_ADCONV1, 0, &adConv1_ChnConfig0);

	ADC_DRV_WaitConvDone(INST_ADCONV1);

	ADC_DRV_GetChanResult(INST_ADCONV1, 0, &ADC_result);

	return ADC_result;
}
 
uint16_t ADC_GET_EXT1(void)
{
	uint16_t ADC_result = 0;

	ADC_DRV_ConfigChan(INST_ADCONV1, 0, &adConv1_ChnConfig1);

	ADC_DRV_WaitConvDone(INST_ADCONV1);

	ADC_DRV_GetChanResult(INST_ADCONV1, 0, &ADC_result);

	return ADC_result;
}

uint16_t ADC_GET_EXT2(void)
{
	uint16_t ADC_result = 0;

	ADC_DRV_ConfigChan(INST_ADCONV1, 0, &adConv1_ChnConfig2);

	ADC_DRV_WaitConvDone(INST_ADCONV1);

	ADC_DRV_GetChanResult(INST_ADCONV1, 0, &ADC_result);

	return ADC_result;
}
 
uint16_t ADC_GET_EXT3(void)
{
	uint16_t ADC_result = 0;

	ADC_DRV_ConfigChan(INST_ADCONV1, 0, &adConv1_ChnConfig3);

	ADC_DRV_WaitConvDone(INST_ADCONV1);

	ADC_DRV_GetChanResult(INST_ADCONV1, 0, &ADC_result);

	return ADC_result;
}

 
